home *** CD-ROM | disk | FTP | other *** search
/ Delphi Programmer's Power Pack / Delphi Volume 1.iso / s_to_z / wmapdemo / data.z / FINDPT.PAS < prev    next >
Pascal/Delphi Source File  |  1996-03-09  |  2KB  |  71 lines

  1. unit Findpt;
  2.  
  3. interface
  4.  
  5. uses WinTypes, WinProcs, Classes, Graphics, Forms, Controls, Buttons,
  6.   StdCtrls, ExtCtrls,Dialogs;
  7.  
  8. type
  9.   TFindDlg = class(TForm)
  10.     OKBtn: TBitBtn;
  11.     CancelBtn: TBitBtn;
  12.     HelpBtn: TBitBtn;
  13.     Bevel1: TBevel;
  14.     RadioGroup1: TRadioGroup;
  15.     RBLat: TRadioButton;
  16.     RBLong: TRadioButton;
  17.     RBLabel: TRadioButton;
  18.     RBTag: TRadioButton;
  19.     Label1: TLabel;
  20.     Searchtext: TEdit;
  21.     procedure OKBtnClick(Sender: TObject);
  22.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  23.   private
  24.     { Private declarations }
  25.   public
  26.     { Public declarations }
  27.   end;
  28.  
  29. var
  30.   FindDlg: TFindDlg;
  31.  
  32. implementation
  33. uses Mapmain,worldmap;
  34. {$R *.DFM}
  35.  
  36.  
  37. procedure TFindDlg.OKBtnClick(Sender: TObject);
  38. var
  39.  Index : integer;
  40.  APoint : TPointObject;
  41. begin
  42.   APoint := TPointObject.Create;
  43.   try
  44.     with Mapform.Worldmap1 do begin
  45.       if RBLat.checked then
  46.         Index := FindPoint(ftLat,searchtext.text,0)
  47.       else if RBLong.checked then
  48.         Index := FindPoint(ftLong,searchtext.text,0)
  49.       else if RBLabel.checked then
  50.         Index := FindPoint(ftLabel,searchtext.text,0)
  51.       else if RBTag.checked then
  52.         Index := FindPoint(ftTag,searchtext.text,0);
  53.       if Index <> -1 then begin
  54.         GetPoint(Apoint,Index);
  55.         ZoominbyFactor(Apoint.dlat div 60,Apoint.dlong div 60,1);
  56.       end else
  57.         messagedlg('No points found',mtInformation,[mbOk],0);
  58.     end;
  59.   finally
  60.     Apoint.free;
  61.   end;
  62. end;
  63.  
  64. procedure TFindDlg.FormClose(Sender: TObject; var Action: TCloseAction);
  65. begin
  66.   action := caFree;
  67.  
  68. end;
  69.  
  70. end.
  71.